
class Solution:
    def addBinary(self, a: str, b: str) -> str:
        def s2n(s):
            n = 0
            for si in s:
                n = n * 2 + int(si)
            return n

        def n2s(n):
            if n == 0:
                return '0'
            s = ''
            while n > 0:
                s += str(n % 2)
                n //= 2
            return s[::-1]
        return n2s(s2n(a) + s2n(b))


a = "11"
b = "1"
solve = Solution()
print(a, b)
print(solve.addBinary(a, b))
